Skip to content

[4주차] 한하람/[feat] 추가 api 구현#162

Merged
Hanharam merged 12 commits intoLeets-Official:한하람/mainfrom
Hanharam:한하람/4주차
May 3, 2026

Hidden character warning

The head ref may contain hidden characters: "\ud55c\ud558\ub78c/4\uc8fc\ucc28"
Merged

[4주차] 한하람/[feat] 추가 api 구현#162
Hanharam merged 12 commits intoLeets-Official:한하람/mainfrom
Hanharam:한하람/4주차

Conversation

@Hanharam
Copy link
Copy Markdown

@Hanharam Hanharam commented Apr 28, 2026

1. 과제 요구사항 중 구현한 내용

  • 게시글 신고 기능 구현
  • 댓글 신고 기능 구현
  • 댓글 검토중 기능 구현 (PENDING -> REVIEWING)

2. 핵심 변경 사항

  • Report.java (Domain): 도메인 불변성을 유지하기 위해 reconstruct, create 팩토리 메서드 및 데이터 유효성 검증 로직(validateReason 등) 구현
  • ReportJpaEntity.java (Persistence Entity): JPA 엔티티와 도메인 모델을 분리하고, 상호 변환을 위한 from(), toDomain() 매퍼 메서드 구현
  • ReportPersistenceAdapter.java (Persistence Adapter): LoadReportPort, SaveReportPort 인터페이스를 구현하여 영속성 계층의 세부 구현을 도메인으로부터 격리
  • ReportController.java (Web Adapter): 게시글(POST /posts/{postId}) 및 댓글(POST /comments/{commentId}) 신고 API 엔드포인트 구현
  • CreateReportRequest.java (Web DTO): 웹 계층의 요청 데이터를 캡슐화하고, 유즈케이스 포트에 전달할 Command 객체로의 변환 로직 구현

3. 실행 및 검증 결과

  • 실행 결과:
  • 게시글 신고
image image

한번 더 신고:
image

게시글이 존재하지 않음:
image

  • 댓글 신고
image image

한번 더 신고:
image

댓글이 존재하지 않음:
image

250자 초과:
image

  • 신고 검토중 처리
image image

검토중 한번 더 실행:
image

잘못된 report Id:
image

4. 완료 사항

  1. 도메인 모델링
  2. 계층간 격리
  3. 신고 API 구현

5. 추가 사항

제출 체크리스트

  • PR 제목이 규칙에 맞다
  • base가 {이름}/main 브랜치다
  • compare가 {이름}/{숫자}주차 브랜치다
  • 프로젝트가 정상 실행된다
  • 본인을 Assignee로 지정했다
  • 파트 담당 Reviewer를 지정했다
  • 리뷰 피드백을 반영한 뒤 머지/PR close를 진행한다

Reviewer 참고

Copy link
Copy Markdown

@gusanans218 gusanans218 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

신고 기능을 포트/어댑터 구조로 분리해서 구현한 점이 좋았습니다
Controller → UseCase → Service → Port → PersistenceAdapter 흐름이 명확해서 각 계층의 책임이 잘 드러나는 코드라고 느꼈습니다!!

@Hanharam Hanharam requested a review from a team April 30, 2026 05:10
@Hanharam Hanharam self-assigned this Apr 30, 2026
Copy link
Copy Markdown

@N-yujeong N-yujeong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ResourceType과 PermissionType으로 권한 체계를 깔끔하게 설계하신 부분이 좋습니다!

LoadCommentPort의 TODO에서 언급하신 대로, existsById 기반 검증보다는 실제 Comment 도메인을 조회하는 방식으로 변경하면 더 강력한 설계가 될 것 같습니다.

Copy link
Copy Markdown

@jihoonkim501 jihoonkim501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 헥사고날 아키텍쳐를 잘 몰라서 어렵군요.. 그래도 코드가 간결하고 일관성이 있어서 그나마 잘 읽히는 것 같습니다! 수고하셨습니다 하람님~!

Comment on lines +89 to +101
// 신고자 아이디 검증
private static void validateReporterId(Long reporterId) {
if (reporterId == null || reporterId <= 0) {
throw new ReportDomainException(ReportErrorCode.INVALID_REPORTER_ID);
}
}
// 타겟 유형 검증
private static void validateTargetType(ReportTargetType targetType) {
if (targetType == null) {
throw new ReportDomainException(ReportErrorCode.INVALID_TARGET_TYPE);
}
}
// 타겟 아이디 검증
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엔티티 메소드로 검증 좋습니다~!

@Hanharam Hanharam merged commit cf5bf19 into Leets-Official:한하람/main May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants